import 'package:flutter/material.dart';

class TodoFaceLoginBox extends StatelessWidget {
  TodoFaceLoginBox({
    Key key,
    @required this.avaterUrl,
    this.nickName,
    this.username = "",
    this.onLogin,
  }) : super(key: key);

  final ImageProvider avaterUrl;
  final String nickName;
  final String username;
  final VoidCallback onLogin;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: nickName == null ? onLogin : null,
      child: Row(
        children: <Widget>[
          CircleAvatar(backgroundImage: avaterUrl),
          SizedBox(width: 10),
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Text(
                nickName ?? "请登录",
                style: TextStyle(
                  fontWeight: FontWeight.bold,
                  fontSize: 15,
                  height: 2,
                ),
              ),
              Text(
                "Github：$username",
                style: TextStyle(fontSize: 12, color: Theme.of(context).disabledColor),
              )
            ],
          )
        ],
      ),
    );
  }
}
